package cn.myjerry.memento;

public class Client {
	public static void main(String[] args) {
		Caretaker taker = new Caretaker();
		
		Emp emp = new Emp("Jerry", 18, 10000);
		System.out.println("第一次打印：=>" + emp.getName() + "==>" + emp.getAge() + "==>" + emp.getSalary());
		
		System.out.println("手动备忘");
		taker.setEmpMemento(new EmpMemento(emp));
		
		emp.setName("Tom");
		emp.setAge(35);
		emp.setSalary(20000);
		System.out.println("第二次打印：=>" + emp.getName() + "==>" + emp.getAge() + "==>" + emp.getSalary());
		
		System.out.println("从备忘录恢复");
		emp.recovery(taker.getEmpMemento());
		System.out.println("第三次打印：=>" + emp.getName() + "==>" + emp.getAge() + "==>" + emp.getSalary());
		
	}
}
